package com.fjh.mapper;

import com.fjh.domain.SysPermission;
import com.fjh.dto.PermissionDto;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface SysPermissionMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(SysPermission record);

    int insertSelective(SysPermission record);

    SysPermission selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(SysPermission record);

    int updateByPrimaryKey(SysPermission record);
    /**
     * 查询所有的权限数据
     * @return
     */
    List<SysPermission> selectAllSysPermission();

    List<SysPermission> selectByPage(PermissionDto dto);
    /**
     * 使用父亲的id 查询儿子
     * @param parentId 父亲的id
     * @return
     */
    List<SysPermission> selectByParentId(@Param("parentId") Integer parentId);

    Integer selectCountByParentId(Integer parentId);

    List<Integer> selectPermIdByRoleId(Integer roleId);

    int deleteByRoleIds(Integer roleId);

    int insertNewRole(@Param("roleId") Integer roleId,@Param("permsIds") Integer[] permsIds);

    List<SysPermission> selectPermsByUserIdAndType(@Param("id") Integer id,@Param("types") List<Integer> types);
}